//
//  DetailView.m
//  TT
//
//  Created by lanou3g on 16/3/14.
//  Copyright © 2016年 Super磊. All rights reserved.
//

#import "DetailView.h"

@implementation DetailView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addAllViews];
    }
    return self;
}
- (void)addAllViews {
    
    self.headV = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenWidth + 60)];
    [self addSubview:self.headV];
    
    self.scrollV = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenWidth)];
    self.scrollV.pagingEnabled = YES;
    self.scrollV.contentSize = CGSizeMake(kScreenWidth * 6, 0);
    [self.headV addSubview:self.scrollV];
    self.pageC = [[UIPageControl alloc] initWithFrame:CGRectMake(140, kScreenWidth - 50, 95, 30)];
    self.pageC.numberOfPages = 6;
    self.pageC.currentPageIndicatorTintColor = [UIColor whiteColor];
    self.pageC.tintColor = [UIColor grayColor];
    [self.headV addSubview:self.pageC];
    
//    self.bottomV = [[UIView alloc] initWithFrame:CGRectMake(0, kScreenWidth, kScreenWidth, 60)];
//    [self.headV addSubview:self.bottomV];
    self.name_age = [[UILabel alloc] initWithFrame:CGRectMake(0, kScreenWidth, 160, 30)];
    [self.headV addSubview:self.name_age];
    self.distance_time = [[UILabel alloc] initWithFrame:CGRectMake(0, kScreenWidth + 30, 160, 30)];
    [self.headV addSubview:self.distance_time];
    
    self.cancel = [UIButton buttonWithType:(UIButtonTypeSystem)];
    [self.cancel setFrame:CGRectMake(260, kScreenWidth + 10, 40, 40)];
    [self.cancel setImage:[UIImage imageNamed:@"cancel"] forState:(UIControlStateNormal)];
    [self.headV addSubview:self.cancel];
    self.agree = [UIButton buttonWithType:(UIButtonTypeSystem)];
    [self.agree setFrame:CGRectMake(320, kScreenWidth + 10, 40, 40)];
    [self.agree setImage:[UIImage imageNamed:@"agree"] forState:(UIControlStateNormal)];
    [self.headV addSubview:self.agree];
    
    self.tableV = [[UITableView alloc] initWithFrame:[UIScreen mainScreen].bounds style:(UITableViewStyleGrouped)];
    [self addSubview:self.tableV];
    self.tableV.tableHeaderView = self.headV;
    
    self.tableV.backgroundColor = [UIColor yellowColor];
    self.headV.backgroundColor = [UIColor cyanColor];
//    self.bottomV.backgroundColor = [UIColor redColor];
    self.name_age.backgroundColor = [UIColor blueColor];
    self.distance_time.backgroundColor = [UIColor grayColor];
    self.scrollV.backgroundColor = [UIColor brownColor];
}

@end
